#ifndef ROTATION_READER_FERT_H
#define ROTATION_READER_FERT_H
#include "stdafx.h"
class IN_read_fertrotation
{
public:
		list2d *fertlist;
		Inp_fertrot *fertrot;
		Inp_croprot *croprot;
		time_intervall timint;
		string name;

		IN_read_fertrotation (list2d *ifertlist,Inp_fertrot *ifertrot, Inp_croprot *icroprot,
			time_intervall time_mod, string sitename)
		{
			fertlist=ifertlist;
			fertrot=ifertrot;
			croprot=icroprot;
			timint=time_mod;
			name=sitename;
		}
};
class read_fertrotation
{
	static Par_Maps par_fert_props;
	static int Flag_par_fert_props;
	
	static int read_sitespecific_fert_history_with_complete_date(
		IN_read_fertrotation &input,int firstentry_pos,int lastentry_pos);
	static int read_sitespecific_fert_history_with_year_date(IN_read_fertrotation &input,int firstentry_pos,int lastentry_pos);
	
	static int write_N_C_into_fertrot(IN_read_fertrotation &input);
	

public:
	
	static void read_Parameter_Maps()
		 {
			//This method reads the paramterfile
			string root="./par/";
			string suffix=".par";
			string name="Par_Fert_Props";
			par_fert_props.read_Par_Maps(root,name,suffix);
		}
	static int read_fertrot (IN_read_fertrotation &input);
	
		// builds up a fertrotation from entries in fertrot file
		// 1. There are two cases 
			//1.1 For a site  A L L dates are COMPLETE and fert amounts are given
			//1.2 For a site O N L Y the YEARS of fertilizer application are given	(months days are negative)
				 // In this case there is another split
					// 1.2.1 More applications per year. In this case dates will be searched automatically
					// 1.2.2.Just one application per year. In this case the amount will be split by a decision system in dependence 
							 // of the respective crop
		//units: input in T O N S freshmatter [t FM]

		//1. Test if parameter sets are loaded
	
	static int write_N_C_into_fertlist(IN_read_fertrotation &input);	
	
};
#endif
